Skip to content
  • 0 Votes
    2 Posts
    609 Views
    AxelViennaA

    Bonjour,
    es-tu sûr que le jpg a la bonne taille et qu'il peut être affiché dans le QPushButton ?
    Voici une petite méthode pour mettre une icône à la bonne taille.
    Salutations de Vienne, où il fait froid, dans le lockdown.
    Axel

    QImage tint(QString icon, QColor color, qreal strength, int w, int h) { QImage src = QIcon(icon).pixmap(QSize(w,h)).toImage(); if(src.isNull()) return QImage(); QGraphicsScene scene; QGraphicsPixmapItem item; item.setPixmap(QPixmap::fromImage(src)); QGraphicsColorizeEffect effect; effect.setColor(color); effect.setStrength(strength); item.setGraphicsEffect(&effect); scene.addItem(&item); QImage res = src; QPainter ptr(&res); scene.render(&ptr, QRectF(), src.rect() ); return res; }
  • 0 Votes
    5 Posts
    587 Views
    cfdevC

    @Sai-Raul
    Look : https://doc.qt.io/qt-5/qscrollarea.html

    Whitout Qlablel.. There is QGraphicsScene with QGraphicsView.

  • 0 Votes
    9 Posts
    569 Views
    jsulmJ

    @duckrae First remove all that thread stuff

  • 0 Votes
    1 Posts
    196 Views
    No one has replied
  • 0 Votes
    2 Posts
    566 Views
    KroMignonK

    @Osama-Adel Please add Android SDK Command-line Tools, it is required to enable android build with QtCreator

  • 0 Votes
    19 Posts
    2k Views
    Vivek_AV

    still in mingw way problem not solved .
    so i choose msvc compiler to do that .. so iam closing this ...

  • 0 Votes
    4 Posts
    517 Views
    Pablo J. RoginaP

    @SergeyK12 said in Qt creator console project isnt worked in release mode, but worked in debug!:

    And everything worked!

    Glad you found out. Please don't forget to mark your post as solved!

  • 0 Votes
    6 Posts
    934 Views
    K

    Qt creator seems to work. Therefore I am not worrying about the statistic plugin message.

  • 0 Votes
    42 Posts
    8k Views
    A

    Is it correct to say that now the "main project" has all the code of "chess" added so basically there is only one application running?

    The objective to "have two windows" has been met, however, adding more "child applications" using same philosophy of "cut and paste" is not what " reusing code " means to me.

  • 0 Votes
    21 Posts
    4k Views
    Pablo J. RoginaP

    @suslucoder said in Windows not responding on reading file from txt:

    It works

    so please don't forget to mark your post as solved!

  • 0 Votes
    3 Posts
    988 Views
    ConfusedKeystrokesC

    @lorn-potter Thanks for getting back to me!

    I'm trying to build this project:
    https://github.com/herewegoblueno/cs1230-final
    Just to provide context, this works well when built for Mac.

    And yes I am importing GL/glew.h myself.

    Also by the way I've also noticed that the compilers don't recognize the standard libraries like <vector>, <map>, etc (or maybe that's just the static checker? not sure if those will result in compile time errors since I can't build due to glew anyways)

  • 0 Votes
    1 Posts
    631 Views
    No one has replied
  • 0 Votes
    2 Posts
    1k Views
    T

    I've developed a hackish workaround - if you're frustrated by this issue too, this "fix" is ugly but might help in the short-term:

    I noticed that Qt Creator still recognizes the old qmlRegisterType function calls if they're invoked from main in a project. So naturally, I made a custom compiler step for qmake that generates a header file with all QML_ELEMENT-tagged classes registered in a function.

    First, make sure you've set up qmltypes in your project as usual - your QML_IMPORT_NAME and all that is set.

    Add to the bottom of MyProject.pro:

    type_registrar_unfucker.name = type_registrar_unfucker type_registrar_unfucker.input = TYPE_REGISTRAR_SOURCES type_registrar_unfucker.commands = python3 $$PWD/type_unfuck.py ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} $$QML_IMPORT_NAME $$QML_IMPORT_MAJOR_VERSION type_registrar_unfucker.output = ${QMAKE_FILE_IN_BASE}.h type_registrar_unfucker.clean = ${QMAKE_FILE_IN_BASE}.h type_registrar_unfucker.variable_out = HEADERS QMAKE_EXTRA_COMPILERS += type_registrar_unfucker TYPE_REGISTRAR_SOURCES += $$OUT_PWD/myproject_metatypes.json

    Add as type_unfuck.py in your source directory:

    # type unfuck # ----------- # This python script deals with the issue of Qt Creator not being able to recognize element types # registered using 'QML_ELEMENT'. # # It does so by generating a header, 'myprojectname_metatypes.h'. # Include this header ONLY in main.cpp, and then call `registerTypes()` first thing in `main`. # Then, Qt Creator will stop whining. import sys import json source_path = sys.argv[1] dest_path = sys.argv[2] import_name = sys.argv[3] import_major = sys.argv[4] with open(source_path) as f: data = json.load(f) includes = ["QtQml"] types = [] for file in data: includes.append(file["inputFile"]) for type in file["classes"]: if "classInfos" in type and {"name":"QML.Element","value":"auto"} in type["classInfos"]: types.append(type["className"]) with open(dest_path, 'w') as f: for i in includes: f.write(f'#include <{i}>\n') f.write('void registerTypes() {\n') for t in types: f.write(f'\tqmlRegisterType<{t}>("{import_name}", {import_major}, 0, "{t}");\n') f.write('}\n')

    Then, just add #include <myproject_metatypes.h> to your project's main.cpp and invoke registerTypes(); immediately in your main function. Build your project, then click on Tools -> QML/JS -> Reset Code Model, and Qt Creator should now recognize your custom components correctly.

  • 0 Votes
    2 Posts
    2k Views
    JKSHJ

    @Ahsan-Niaz said in Releasing exe for 32 bit windows from a 64 bit windows qt creator:

    Is it possible to add kits or whatever in my current qt creator.

    Yes

    As I already mentioned, I already have a project running perfectly on 64 bit windows. I want to create an exe that should run perfectly on 32 bit windows.
    Please guide me with what steps I should follow. Thanks

    Close Qt Creator Run MaintenanceTool.exe Select and install a 32-bit version of Qt from the MaintenanceTool Install a compatible 32-bit compiler If you're using MinGW, install it from the Qt installer If you're using MSVC, install it from Microsoft's website Open your project in Qt Creator and enable your 32-bit kit: https://doc.qt.io/qtcreator/creator-configuring-projects.html Build and deploy your application using your 32-bit kit

    I don't want to reinstall qt and select the packages or kits because its a headache.

    You don't need to reinstall Qt.

    You must install a new version of Qt on top of your existing installation.

    Recently, I had to run an exe released from 64bit windows qt creator for my client on his 32 bit windows.

    The bitness of Qt Creator does not matter. What's important is the bitness of your kit. (Qt Creator can manage many versions of Qt, both 32-bit and 64-bit, at the same time)

  • 0 Votes
    20 Posts
    4k Views
    B

    @aha_1980 Yes, I've just read the report and yes, that's exactly want I wanted to do! I'll definitely vote there, tank you! :)

  • 0 Votes
    1 Posts
    550 Views
    No one has replied
  • 0 Votes
    3 Posts
    750 Views
    V

    Hello thanks for reply,
    Yes ctc32 is an executable and args -i m for instrumentation multi-condition code coverage.
    I added these lines to my project file.

    CodeCoverage { CTC32 += ctc32 -i m } QMAKE_CC = CTC32$$QMAKE_CXX QMAKE_CXX = CTC32$$QMAKE_CXX

    I really don't understand how to tell Qt creator to call ctc32 before calling g++ (or in other words ctc32 will call g++). I had a look on qmake Variable Reference but this is the only thing I got.

    Thank you

  • 0 Votes
    5 Posts
    2k Views
    ad1170A

    I had the same issue. In my case, it was a wrong run configuration.
    (left pane) "Projects" -> "Build & Run" -> "Run" -> "Run" -> "Run configuration:"
    Make sure the you have selected the right configuration.

    Qt-project-run-config.png

  • 0 Votes
    4 Posts
    746 Views
    JKSHJ

    @ricardovaras_99 said in What library should I use for animation in Qt Widgets Application?:

    And I want to simulate water level increasing on a tank.

    Do you want to animate the water level (in other words, make the level rise or fall at a specific speed in real time)? Or do you just want to display the water level? (in other words, make the picture show the latest level)?

    If you want the latter, have a look at the Qt Quick Coffee Machine demo:

    Video: https://resources.qt.io/videos/built-with-qt-qt-quick-coffee-machine-demo-qtws17 Code: https://doc.qt.io/qt-5/qtdoc-demos-coffee-example.html